$(document).ready(function(){
	
	$('#download').click(function(e){

		if($('#level_name').val() == null || $('#level_name').val().length < 1) {
			alert("The name of the level should be entered!");
		}
	
		$.generateFile({
			filename	: $('#level_name').val(),
			content		: $('textarea').val(),
			script		: 'download.php'
		});
		
		e.preventDefault();
		
		alert("Level saved under name " + $('#level_name').val())
	});	
});